home *** CD-ROM | disk | FTP | other *** search
- // By overloading the [] operator you can treat lists like arrays
-
- APTR operator [] (LONG pos)
- {
- APTR entry;
- DoMethod (MUIM_List_GetEntry, pos, &entry);
- return entry;
- }
-
- // This method is a convienient alternative to the Entries attribute
-
- LONG Length (void) const
- {
- return (LONG)GetAttr (MUIA_List_Entries);
- }
-
- // This method can be used to retrieve the number of selected entries
- // in a list
-
- ULONG NumSelected (void)
- {
- ULONG numSelected;
- DoMethod (MUIM_List_Select, MUIV_List_Select_All, MUIV_List_Select_Ask, &numSelected);
- return numSelected;
- }
-
- // These methods can be used as shortcuts for inserting objects into lists
-
- void AddHead (APTR entry)
- {
- DoMethod (MUIM_List_InsertSingle, entry, MUIV_List_Insert_Top);
- }
-
- void AddTail (APTR entry)
- {
- DoMethod (MUIM_List_InsertSingle, entry, MUIV_List_Insert_Bottom);
- }
-
- void InsertTop (APTR entry)
- {
- DoMethod (MUIM_List_InsertSingle, entry, MUIV_List_Insert_Top);
- }
-
- void InsertBottom (APTR entry)
- {
- DoMethod (MUIM_List_InsertSingle, entry, MUIV_List_Insert_Bottom);
- }
-
- void InsertSorted (APTR entry)
- {
- DoMethod (MUIM_List_InsertSingle, entry, MUIV_List_Insert_Sorted);
- }
-
- void InsertActive (APTR entry)
- {
- DoMethod (MUIM_List_InsertSingle, entry, MUIV_List_Insert_Active);
- }
-
-